home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / c / libiconv_src.lha / src / converters.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-07  |  5.9 KB  |  227 lines

  1. /* Copyright (C) 1999-2000 Free Software Foundation, Inc.
  2.    This file is part of the GNU ICONV Library.
  3.  
  4.    The GNU ICONV Library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public License as
  6.    published by the Free Software Foundation; either version 2 of the
  7.    License, or (at your option) any later version.
  8.  
  9.    The GNU ICONV Library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public
  15.    License along with the GNU ICONV Library; see the file COPYING.LIB.  If not,
  16.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.    Boston, MA 02111-1307, USA.  */
  18.  
  19. /* This file defines all the converters. */
  20.  
  21.  
  22. /* Define our own notion of wchar_t, as UCS-4, according to ISO-10646-1. */
  23. #undef wchar_t
  24. #define wchar_t  unsigned int
  25.  
  26. /* State used by a conversion. 0 denotes the initial state. */
  27. typedef unsigned int state_t;
  28.  
  29. /* iconv_t is an opaque type. This is the real iconv_t type. */
  30. typedef struct conv_struct * conv_t;
  31.  
  32. /*
  33.  * Data type for conversion multibyte -> unicode
  34.  */
  35. struct mbtowc_funcs {
  36.   int (*xxx_mbtowc) (conv_t conv, wchar_t *pwc, unsigned char const *s, int n);
  37.   /*
  38.    * int xxx_mbtowc (conv_t conv, wchar_t *pwc, unsigned char const *s, int n)
  39.    * converts the byte sequence starting at s to a wide character. Up to n bytes
  40.    * are available at s. n is >= 1.
  41.    * Result is number of bytes consumed (if a wide character was read),
  42.    * or 0 if invalid, or -1 if n too small, or -1-(number of bytes consumed)
  43.    * if only a shift sequence was read.
  44.    */
  45. };
  46.  
  47. /*
  48.  * Data type for conversion unicode -> multibyte
  49.  */
  50. struct wctomb_funcs {
  51.   int (*xxx_wctomb) (conv_t conv, unsigned char *r, wchar_t wc, int n);
  52.   /*
  53.    * int xxx_wctomb (conv_t conv, unsigned char *r, wchar_t wc, int n)
  54.    * converts the wide character wc to the character set xxx, and stores the
  55.    * result beginning at r. Up to n bytes may be written at r. n is >= 1.
  56.    * Result is number of bytes written, or 0 if invalid, or -1 if n too small.
  57.    */
  58.   int (*xxx_reset) (conv_t conv, unsigned char *r, int n);
  59.   /*
  60.    * int xxx_reset (conv_t conv, unsigned char *r, int n)
  61.    * stores a shift sequences returning to the initial state beginning at r.
  62.    * Up to n bytes may be written at r. n is >= 0.
  63.    * Result is number of bytes written, or -1 if n too small.
  64.    */
  65. };
  66.  
  67. /* Return code if invalid. (xxx_mbtowc, xxx_wctomb) */
  68. #define RET_ILSEQ      0
  69. /* Return code if only a shift sequence of n bytes was read. (xxx_mbtowc) */
  70. #define RET_TOOFEW(n)  (-1-(n))
  71. /* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */
  72. #define RET_TOOSMALL   -1
  73.  
  74. /*
  75.  * Contents of a conversion descriptor.
  76.  */
  77. struct conv_struct {
  78.   /* Input (conversion multibyte -> unicode) */
  79.   int iindex;
  80.   struct mbtowc_funcs ifuncs;
  81.   state_t istate;
  82.   /* Output (conversion unicode -> multibyte) */
  83.   int oindex;
  84.   struct wctomb_funcs ofuncs;
  85.   int oflags;
  86.   state_t ostate;
  87.   /* Operation flags */
  88.   int transliterate;
  89. };
  90.  
  91. /*
  92.  * Include all the converters.
  93.  */
  94.  
  95. #include "ascii.h"
  96.  
  97. /* General multi-byte encodings */
  98. #include "utf8.h"
  99. #include "ucs2.h"
  100. #include "ucs2be.h"
  101. #include "ucs2le.h"
  102. #include "ucs4.h"
  103. #include "ucs4be.h"
  104. #include "ucs4le.h"
  105. #include "utf16.h"
  106. #include "utf16be.h"
  107. #include "utf16le.h"
  108. #include "utf7.h"
  109. #include "ucs2internal.h"
  110. #include "ucs2swapped.h"
  111. #include "ucs4internal.h"
  112. #include "ucs4swapped.h"
  113. #include "java.h"
  114.  
  115. /* 8-bit encodings */
  116. #include "iso8859_1.h"
  117. #include "iso8859_2.h"
  118. #include "iso8859_3.h"
  119. #include "iso8859_4.h"
  120. #include "iso8859_5.h"
  121. #include "iso8859_6.h"
  122. #include "iso8859_7.h"
  123. #include "iso8859_8.h"
  124. #include "iso8859_9.h"
  125. #include "iso8859_10.h"
  126. #include "iso8859_13.h"
  127. #include "iso8859_14.h"
  128. #include "iso8859_15.h"
  129. #include "iso8859_16.h"
  130. #include "koi8_r.h"
  131. #include "koi8_u.h"
  132. #include "koi8_ru.h"
  133. #include "cp1250.h"
  134. #include "cp1251.h"
  135. #include "cp1252.h"
  136. #include "cp1253.h"
  137. #include "cp1254.h"
  138. #include "cp1255.h"
  139. #include "cp1256.h"
  140. #include "cp1257.h"
  141. #include "cp1258.h"
  142. #include "cp850.h"
  143. #include "cp866.h"
  144. #include "mac_roman.h"
  145. #include "mac_centraleurope.h"
  146. #include "mac_iceland.h"
  147. #include "mac_croatian.h"
  148. #include "mac_romania.h"
  149. #include "mac_cyrillic.h"
  150. #include "mac_ukraine.h"
  151. #include "mac_greek.h"
  152. #include "mac_turkish.h"
  153. #include "mac_hebrew.h"
  154. #include "mac_arabic.h"
  155. #include "mac_thai.h"
  156. #include "hp_roman8.h"
  157. #include "nextstep.h"
  158. #include "armscii_8.h"
  159. #include "georgian_academy.h"
  160. #include "georgian_ps.h"
  161. #include "mulelao.h"
  162. #include "cp1133.h"
  163. #include "tis620.h"
  164. #include "cp874.h"
  165. #include "viscii.h"
  166. #include "tcvn.h"
  167.  
  168. /* CJK character sets [CCS = coded character set] [CJKV.INF chapter 3] */
  169.  
  170. typedef struct {
  171.   unsigned short indx; /* index into big table */
  172.   unsigned short used; /* bitmask of used entries */
  173. } Summary16;
  174.  
  175. #include "iso646_jp.h"
  176. #include "jisx0201.h"
  177. #include "jisx0208.h"
  178. #include "jisx0212.h"
  179.  
  180. #include "iso646_cn.h"
  181. #include "gb2312.h"
  182. #include "isoir165.h"
  183. /*#include "gb12345.h"*/
  184. #include "gbk.h"
  185. #include "cns11643.h"
  186. #include "big5.h"
  187.  
  188. #include "ksc5601.h"
  189. #include "johab_hangul.h"
  190.  
  191. /* CJK encodings [CES = character encoding scheme] [CJKV.INF chapter 4] */
  192.  
  193. #include "euc_jp.h"
  194. #include "sjis.h"
  195. #include "cp932.h"
  196. #include "iso2022_jp.h"
  197. #include "iso2022_jp1.h"
  198. #include "iso2022_jp2.h"
  199.  
  200. #include "euc_cn.h"
  201. #include "ces_gbk.h"
  202. #include "gb18030.h"
  203. #include "iso2022_cn.h"
  204. #include "iso2022_cnext.h"
  205. #include "hz.h"
  206. #include "euc_tw.h"
  207. #include "ces_big5.h"
  208. #include "cp950.h"
  209. #include "big5hkscs.h"
  210.  
  211. #include "euc_kr.h"
  212. #include "cp949.h"
  213. #include "johab.h"
  214. #include "iso2022_kr.h"
  215.  
  216. /* Encodings used by system dependent locales. */
  217.  
  218. #ifdef USE_AIX
  219. #include "cp856.h"
  220. #include "cp922.h"
  221. #include "cp943.h"
  222. #include "cp1046.h"
  223. #include "cp1124.h"
  224. #include "cp1129.h"
  225. #endif
  226.  
  227.